import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const Home = (resolve) => {
  import('@/views/home/home').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Group = (resolve) => {
  import('@/views/page/group').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Friend = (resolve) => {
  import('@/views/page/friend').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Container = (resolve) => {
  import('@/views/Container').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Favorite = (resolve) => {
  import('@/views/page/favorite').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Collect = (resolve) => {
  import('@/views/page/collect').then((moudle) => {
    resolve(moudle)
  }).catch()
}

const Notice = (resolve) => {
  import('@/views/page/notice-center').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Main = (resolve) => {
  import('@/views/page/main-page').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const MainGroup = (resolve) => {
  import('@/views/page/group-moment').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Hot = (resolve) => {
  import('@/views/page/hot').then((moudle) => {
    resolve(moudle)
  }).catch()
}

const Recommend = (resolve) => {
  import('@/views/page/articleList').then((moudle) => {
    resolve(moudle)
  }).catch()
}

const Article = (resolve) => {
  import('@/views/page/article').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const FriendPage = (resolve) => {
  import('@/views/page/friend').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const GroupPage = (resolve) => {
  import('@/views/page/group').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const SettingPage = (resolve) => {
  import('@/views/page/setting').then((moudle) => {
    resolve(moudle)
  }).catch()
}

const SecurityCenter = (resolve) => {
  import('@/views/page/securityCenter').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const GroupSettingPage = (resolve) => {
  import('@/views/page/group-setting').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const GroupContacts = (resolve) => {
  import('@/views/page/group-contacts').then((moudle) => {
    resolve(moudle)
  }).catch()
}
const Upload = (resolve) => {
  import('@/components/dialogcontent/upload').then((moudle) => {
    resolve(moudle)
  }).catch()
}

export default new Router({
  routes: [
    // {
    //   path: '/',
    //   name: 'Hello',
    //   component: Hello
    // }
    {
      path: '/',
      redirect: '/home'
    }, {
      path: '/home',
      name: 'Home',
      component: Home
    }, {
      path: '/friend',
      name: 'friend',
      component: Friend
    }, {
      path: '/group',
      name: 'Group',
      component: Group
    }, {
      path: '/container',
      name: 'container',
      component: Container,
      children: [
        {
          path: 'favorite',
          name: 'favorite',
          component: Favorite
        }, {
          path: 'collect',
          name: 'collect',
          component: Collect
        }, {
          path: 'notice',
          name: 'notice',
          component: Notice
        }, {
          path: 'hot',
          name: 'hot',
          component: Hot
        }, {
          path: 'recommend',
          name: 'recommend',
          component: Recommend
        }, {
          path: 'article/:id',
          name: 'article',
          component: Article
        }, {
          path: 'main/:role',
          name: 'main',
          component: Main
        }, {
          path: 'maing/:role',
          name: 'main-group',
          component: MainGroup
        }, {
          path: 'friend',
          name: 'FriendPage',
          component: FriendPage
        }, {
          path: 'group',
          name: 'GroupPage',
          component: GroupPage
        }, {
          path: 'setting',
          name: 'SettingPage',
          component: SettingPage
        }, {
          path: '/group/setting/:group_id',
          name: 'GroupSettingPage',
          component: GroupSettingPage
        }, {
          path: 'SecurityCenter',
          name: 'SecurityCenter',
          component: SecurityCenter
        }, {
          path: '/group/contacts/:group_id',
          name: 'GroupContacts',
          component: GroupContacts
        }, {
          path: 'file',
          name: 'Upload',
          component: Upload
        }
      ]
    }
  ]
})
